package cn.iocoder.yudao.module.shop.dal.mysql.giftitem;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.shop.dal.dataobject.giftitem.ShopGiftItemDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.shop.controller.admin.giftitem.vo.*;

/**
 * 礼品项 Mapper
 *
 * @author 曹建伟
 */
@Mapper
public interface ShopGiftItemMapper extends BaseMapperX<ShopGiftItemDO> {

    default PageResult<ShopGiftItemDO> selectPage(ShopGiftItemPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ShopGiftItemDO>()
                .likeIfPresent(ShopGiftItemDO::getName, reqVO.getName())
                .eqIfPresent(ShopGiftItemDO::getTenantId, reqVO.getTenantId())
                .betweenIfPresent(ShopGiftItemDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(ShopGiftItemDO::getType, reqVO.getType())
                .orderByDesc(ShopGiftItemDO::getId));
    }

    default List<ShopGiftItemDO> selectList(ShopGiftItemExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<ShopGiftItemDO>()
                .likeIfPresent(ShopGiftItemDO::getName, reqVO.getName())
                .betweenIfPresent(ShopGiftItemDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(ShopGiftItemDO::getType, reqVO.getType())
                .orderByDesc(ShopGiftItemDO::getId));
    }

}
